﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.IO;
using System.Data.SqlClient;
using System.Data.Common;
using AjaxControlToolkit;

using Ivy.Common.Framework.Base;

using Ivy.SiteAdmin.Entity;
using Ivy.SiteAdmin.DataAccess;

namespace DasIdeen
{
    public partial class RamTesting : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //DasIdeen_SubscriptionMaster_Insert();
            //DasIdeen_SubscriptionMaster_Update();
            Dasideen_ContentTypeMaster_Insert();
            //Dasideen_ContentTypeMaster_GetByContentTypeKey();
            //Dasideen_ContentTypeMaster_GetByContentTypeCode();
        }
        private void DasIdeen_SubscriptionMaster_Insert()
        {
            //SubscriptionMaster lSubscriptionMaster = new SubscriptionMaster();
            //SubscriptionMasterDao lSubscriptionMasterDao = new SubscriptionMasterDao();
            //lSubscriptionMaster.SubscribItemCode = 102;
            //lSubscriptionMaster.SubscribItemDescription = "Abcde";
            //lSubscriptionMaster.SubscribUserMailID = "sgrkmr827@gmail.com";
            //lSubscriptionMaster.SubscrbDate = Convert.ToDateTime("2014/12/29");
            //lSubscriptionMaster.Sys_CreatedByID = "Pravesh";
            //lSubscriptionMasterDao.Insert(lSubscriptionMaster);
            
           
        }
        private void DasIdeen_SubscriptionMaster_Update()
        {

        ////    SubscriptionMaster lSubscriptionMaster;
        ////    SubscriptionMasterDao lSubscriptionMasterDao = new SubscriptionMasterDao();

        ////    lSubscriptionMaster = lSubscriptionMasterDao.GetByKey(2);

        ////    lSubscriptionMaster.SubscribItemCode = 104;
        ////    lSubscriptionMaster.SubscribItemDescription = "Excel";
        ////    lSubscriptionMaster.SubscribUserMailID = "rampraveshkuma@gmail.com";
        ////    lSubscriptionMaster.SubscrbDate = Convert.ToDateTime("2015/01/06");

        ////    lSubscriptionMaster.Sys_CreatedByID = "ram";
        ////    lSubscriptionMasterDao.Update(lSubscriptionMaster);
        }


        private void Dasideen_ContentTypeMaster_Insert()
        {
            ContentTypeMaster lContentTypeMaster = new ContentTypeMaster();
            ContentTypeMasterDao lContentTypeMasterDao = new ContentTypeMasterDao();
            lContentTypeMaster.ContentTypeCode = "Pages";
            lContentTypeMaster.ContentTypeName = "Technical White Pages";
            lContentTypeMaster.ContentDescription = "Estimation (or estimating) is the process of finding an estimate";
            lContentTypeMaster.Sys_CreatedByID = "Sagar";
            lContentTypeMasterDao.Insert(lContentTypeMaster);

        }

        private void Dasideen_ContentTypeMaster_GetByContentTypeCode()
        {
            ContentTypeMaster lContentTypeMaster;
            ContentTypeMasterDao lContentTypeMasterDao = new ContentTypeMasterDao();
            lContentTypeMaster = lContentTypeMasterDao.GetByContentTypeCode("102");
        }
        //protected void btnUpload_Click(object sender, EventArgs e)
        //{
        //    if (txtFileUpload.HasFile)
        //    {
        //        string fileName = Path.Combine(Server.MapPath("~/DownloadContents/"), txtFileUpload.FileName);

        //        txtFileUpload.SaveAs(fileName);
        //    }
        //}


        protected void AjaxFileUploadEvent(object sender, AjaxFileUploadEventArgs e)
        {
            string filename = System.IO.Path.GetFileName(e.FileName);
            string strUploadPath = "~/DownloadContents/";
            AjaxFileUpload.SaveAs(Server.MapPath(strUploadPath) + filename);
        }


        protected void Imagebutton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            Response.ContentType = "APPLICATION/OCTET-STREAM";
            String Header = "Attachment; Filename=AcroRd32.exe";
            Response.AppendHeader("Content-Disposition", Header);
            System.IO.FileInfo Dfile = new System.IO.FileInfo(Server.MapPath("DownloadContents/AcroRd32.exe"));
            Response.WriteFile(Dfile.FullName);
            Response.End();

           // Downloader.Download("Flowers.png", "FileArchieve/Flowers/Flowers.png");
        }

       

    }
}